version: '3.8'

services:
  db:
    image: postgres:15
    container_name: db
    command: -p 5432
    expose:
        - 5432
    env_file:
      - .env.fastapi.dev

  app:
    build:
      context: .
    env_file:
      - .env.fastapi.dev
    container_name: shift-rest-api
    command: "sh -c 'alembic upgrade head && PYTHONPATH=. python3 utils/data-generation.py && uvicorn src.main:app --host 0.0.0.0 --port 8000'"
    ports:
        - 8000:8000
    depends_on:
      - db
